<script setup lang="ts">
  import {ref} from 'vue'
  import type { userType } from '@/api/interface';
  import {Login} from '@/api/user'
  import { useRouter } from 'vue-router';
  const user =ref<userType>({name:'',password:''})
  const router = useRouter();
  function login(){
    Login(user.value)
    .then(res => {
      if(res.data.code===200){
        sessionStorage.setItem("token",res.data.token)
        router.push('/about')
      }
    })
  }

</script>

<template>
  <main>
    <h1>ts</h1>
    <input type="text" v-model="user.name"> <br>
    <input type="text" v-model="user.password"> <br>
    <button @click="login()">密码</button>

  </main>
</template>
